package com.lagou.edu.controller;

import com.lagou.edu.service.EmailService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {


    private final EmailService emailService;

    public EmailController(EmailService emailService) {
        this.emailService = emailService;
    }


    @GetMapping("/{email}/{code}")
    public boolean mail(
            @PathVariable String email,
            @PathVariable String code
    ) {
        // 发送邮件
        return emailService.mail(email, code);
    }
}
